package com.example.k12.http

import retrofit2.create

object ApiServiceManager {
    val apiServiceMap = mutableMapOf<String, Any>()

    inline fun <reified T> getService(baseUrl: String): T {
        val key = "${baseUrl}_${T::class.java.name}"
        return apiServiceMap.getOrPut(key) {
            NetworkConfig.getRetrofit(baseUrl).create(T::class.java)!!
        } as T
    }
}